<template>
  <el-popconfirm v-loading="loading" :title="message" @onConfirm="confirm">
    <template #reference>
      <el-link type="danger" :underline="false">
        <i class="el-icon-delete"></i>
      </el-link>
    </template>
  </el-popconfirm>
</template>

<script>
export default {
  props: ["message", "editMethod"],
  data() {
    return {
      loading: false
    };
  },
  methods: {
    confirm() {
      this.loading = true;
      this.editMethod().finally(() => {
        this.loading = false;
        this.$emit("delete");
      })
    }
  }
};
</script>

<style>
</style>